package com.alatus.web;

import com.alatus.result.ChartData;
import com.alatus.result.Result;
import com.alatus.result.SummaryData;
import com.alatus.service.StatisticService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class SummaryController {
    @Resource
    private StatisticService statisticService;

    @GetMapping(value = "/api/summary/data")
    public Result getSummary(){
        SummaryData summaryData = statisticService.loadSummary();
        return Result.OK(summaryData);
    }

    @GetMapping(value = "/api/summary/saleFunnel")
    public Result getSaleFunnel(){
        List<ChartData> saleFunnel = statisticService.loadSaleFunnel();
        return Result.OK(saleFunnel);
    }

    @GetMapping(value = "/api/summary/sourcePie")
    public Result getSourcePie(){
        List<ChartData> sourcePie = statisticService.loadSourcePie();
        return Result.OK(sourcePie);
    }
}
